package work.config;

import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Constant {

    public static String crateTime;//= "2019-12-09 15:00:00";
    public static File src = new File("C:\\Users\\dinglei\\Desktop\\原数据");
    public static File work = new File("C:\\Users\\dinglei\\Desktop\\工作空间");

    static {

        long millis = System.currentTimeMillis();

        //小时
        int h = 1000 * 60 * 60;

        //截取小时数
        long t = millis / h * h;

        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");


        crateTime = dateFormat.format(new Date(t));

        System.out.println("时间戳:" + crateTime);

    }

    public static void main(String[] args) {

    }

    static {

        if (!src.exists()) {
            throw new Error("不存在目录:" + src.getAbsolutePath());
        }

        if (!work.exists()) {

            try {
                work.createNewFile();
            } catch (IOException e) {
                e.printStackTrace();
            }

        }

    }

}
